package xyz.xtt.pay.api.enums;

import xyz.xtt.pay.api.dto.PayAttach;

/**
 * 支付交易类型
 * 
 * @author dale
 * @date 2025/1/15
 **/
public enum PayOrderBusinessTypeEnum {
    //铸造类
    @Deprecated
    PERSONAL_MINT(2, "个人铸造上链费",PayAttach.class),
    PERSONAL_MINT_V2(6, "个人铸造上链费V2,支持图片、视频、关系通证",PayAttach.class),

    //权益类
    NFT_VIP_MONTH(3, "数藏藏月度会员",PayAttach.class),
    NFT_VIP_SEASON(4, "数藏藏季度会员",PayAttach.class),
    NFT_VIP_YEAR(5, "数藏藏年度会员",PayAttach.class),

    //卡牌类
    NFT_CARD(9, "实物卡牌申购",PayAttach.class),

    NORMAL(1, "致敬传奇盲盒", PayAttach.class),
    ROSE_MINT(7, "情人节玫瑰花铸造",PayAttach.class),
    BUY_ASSET_1155(8, "购买平台1155协议资产",PayAttach.class),
    C_TO_C(10, "C2C交易",PayAttach.class),
    ASSET_WITH_PHYSICAL(11,"拥有实物的数字资产交易",PayAttach.class),
    NFT_PURCHASE(12,"NFT购买",PayAttach.class),
    NFT_BLIND_BOX(13,"NFT盲盒",PayAttach.class),
    ;

    private final int code;
    private final String desc;
    private final Class<?> attachClass;

    private PayOrderBusinessTypeEnum(int code, String desc, Class<?> attachClass) {
        this.code = code;
        this.desc = desc;
        this.attachClass = attachClass;
    }

    public int getCode() {
        return code;
    }

    public Class<?> getAttachClass() {
        return attachClass;
    }

    public static PayOrderBusinessTypeEnum getByCode(int code) {
        for (PayOrderBusinessTypeEnum value : PayOrderBusinessTypeEnum.values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }

    public static PayOrderBusinessTypeEnum getByName(String name) {
        for (PayOrderBusinessTypeEnum value : PayOrderBusinessTypeEnum.values()) {
            if (value.name().equals(name)) {
                return value;
            }
        }
        return null;
    }
}
